package com.tjetc.view.impl;

import com.tjetc.constant.CommonConstant;
import com.tjetc.exception.MessageException;
import com.tjetc.utils.ScannerUtils;
import com.tjetc.view.ExcelPage;

/**
 * @Author: itda
 * @Date: 2024/5/11 21:52
 * @Description: ExcelPageImpl
 */
public class ExcelPageImpl implements ExcelPage {

    @Override
    public int show() {
        while (true) {
            try {
                System.out.println("1.导出当天收入Excel");
                System.out.println("2.导出本月收入Excel");
                System.out.println("3.导出本月订单Excel");
                System.out.println("4.返回");
                System.out.println("请输入:");
                int option = ScannerUtils.sc.nextInt();
                if (option<1||option>4){
                    throw new MessageException(CommonConstant.COMMAND_ERROR);
                }
                return option;
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }
}
